package com.htd.erp.model;

import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.validation.constraints.NotNull;


/**
 * @author Zhang Guilin
 * 
 */
@Entity
public class PurchaseItem extends AbstractEntity {

	private static final long serialVersionUID = -137915141809651768L;

	@NotNull
	private Product product;

	@ManyToOne
	private Color color;

	@NotNull
	@Embedded
	private PriceDetail priceDetail = new PriceDetail();

	@ManyToOne(fetch = FetchType.LAZY, optional = false)
	private PurchaseTicket purchaseTicket;

	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	public Color getColor() {
		return color;
	}

	public void setColor(Color color) {
		this.color = color;
	}

	public PriceDetail getPriceDetail() {
		return priceDetail;
	}

	public void setPriceDetail(PriceDetail priceDetail) {
		this.priceDetail = priceDetail;
	}

	public PurchaseTicket getPurchaseTicket() {
		return purchaseTicket;
	}

	public void setPurchaseTicket(PurchaseTicket purchaseTicket) {
		this.purchaseTicket = purchaseTicket;
	}
}
